<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Math</title>
</head>

<body>
    <script>
        console.log(Math.PI);
        //四舍五入
        console.log(Math.round(8.61))
        //向上取整
        console.log(Math.ceil(4.1))
        //向下取整
        console.log(Math.floor(3.99))
        //如何获取一个随机数0-1
        console.log(Math.random())
        //输出一个十到二十之间的随机数
        console.log(10 + 10 * Math.random())

        {
            let num = 2
            //计算一个数的平方
            console.log(num * num);
            // 计算2的10次方
            console.log(Math.pow(num, 10));
            console.log(num ** 10)
            // 计算2的0.5次方
            console.log(Math.pow(num, 0.5))
            console.log(Math.sqrt(num))
        }
    </script>
    
</body>

</html>